//
// Created by lugang on 2024/6/25.
//

#ifndef NET_SOCKETMANAGER_H
#define NET_SOCKETMANAGER_H
#include <set>

class SocketManager
{
private:
    std::set<int> socket_set_;
    SocketManager() = default;
public:
    static SocketManager& GetInstance()
    {
        static SocketManager socketManager;
        return socketManager;
    }
    auto AddFd(const int fd) -> void
    {
        socket_set_.insert(fd);
    }

    auto ContainsFd(const int fd) ->bool
    {
        return socket_set_.find(fd) != socket_set_.end();
    }

    auto RemoveFd(const int fd) ->void
    {
        socket_set_.erase(fd);
    }
};


#endif //NET_SOCKETMANAGER_H
